#ifndef STAFFWIN_H
#define STAFFWIN_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QMessageBox>
#include <QString>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QPushButton>

namespace Ui {
class staffwin;
}

class staffwin : public QMainWindow
{
    Q_OBJECT

public:
    explicit staffwin(QWidget *parent = nullptr);
    ~staffwin();

    void setStaffInfo(const QString &username);

private slots:

    void on_ListAbnormalBtn_clicked();

    void on_ListUnsentBtn_clicked();

    void on_QuickInputStorageBtn_clicked();

    void on_processStorageBtn_clicked();

    void on_ViewNotificationBtn_clicked();

    void on_SendNotificationBtn_clicked();

private:
    QString m_message;
    Ui::staffwin *ui;

    QStandardItemModel *model;
    QSqlDatabase sqlDb;

    int currentPage;
    int pageSize;
    int totalItems;
    QString currentTable;

    // Pagination slots
    void onNextPageClicked();
    void onPrevPageClicked();
    void onPageNumberChanged(int page);

    void loadAbnormalPackagesIntoTable();
    void loadUnsentPackagesIntoTable();
    void loadQuickInputIntoTbale();

    // Pagination helpers
    void setupPagination();
    void updatePagination();
    int calculateTotalPages();
    void updatePageNavigationStatus();

    // Initialize database connection
    bool initDatabase();

};

#endif // STAFFWIN_H
